package com.gxar.quick.ar.server.base.model.protocol.client.wechat_mp;

import com.gxar.quick.ar.server.base.model.protocol.common.CommonArItemTextModel;
import lombok.Data;

import java.util.Objects;

/**
 * 文本信息
 *
 * @author zxh
 * @version 1.0
 * @created 2024/01/02.
 */
@Data
public class WechatMpClientArItemTextModel {

    /**
     * 文本内容
     */
    private String content;

    /**
     * 字体
     */
    private String font;

    /**
     * 字体大小
     */
    private String size;

    /**
     * 文本行间距
     */
    private String lineSpacing;

    /**
     * 字体颜色
     */
    private String color;

    public static WechatMpClientArItemTextModel from(CommonArItemTextModel inputModel) {
        if (Objects.isNull(inputModel)) {
            return null;
        }

        WechatMpClientArItemTextModel outputModel = new WechatMpClientArItemTextModel();

        outputModel.setContent(inputModel.getContent());
        outputModel.setFont(inputModel.getFontStyle());
        if (Objects.nonNull(inputModel.getFontSize())) {
            outputModel.setSize(inputModel.getFontSize().toString());
        }
        if (Objects.nonNull(inputModel.getLineSpacing())) {
            outputModel.setLineSpacing(inputModel.getLineSpacing().toString());
        }
        outputModel.setColor(inputModel.getColor());

        return outputModel;
    }
}
